﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class NewsType_delete : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            try
            {
                string id = Request["id"];
                CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
                dal.NewsType.DeleteObject(dal.NewsType.First(x => x.id == id));
                ClientScript.RegisterStartupScript(GetType(), "bb", "alert('删除成功');document.location='default.aspx'", true);
                dal.SaveChanges();
            }
            catch (Exception ex)
            {
                LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "deleteNewsType", LogYuMin.LogStates.ERROR, ex);
                ClientScript.RegisterStartupScript(GetType(), "aa", "alert('删除失败');document.location='default.aspx'", true);
            }
        }
    }
}